from api.base_api import BasePrimeAdminApi
import random


class SetAddressIdApi(BasePrimeAdminApi):

    def __init__(self, address_id):
        super().__init__()
        self.url = f'{self.host}/trade/checkout-params/address-id/{address_id}'
        self.method = 'post'


class SetPayTypeApi(BasePrimeAdminApi):
    def __init__(self, payment_type='COD'):
        super().__init__()
        self.url = f'{self.host}/trade/checkout-params/payment-type'
        self.method = 'post'
        self.data = {
            'payment_type': payment_type
        }


class AuditInvestListApi(BasePrimeAdminApi):
    """
    查询理财项目审核列表
    """

    def __init__(self):
        super().__init__()
        self.url = f'{self.host}/api/prime/audit/invest/list'
        self.method = 'get'
        self.params = {
            "auditId": '',
            "investName": '',
            "investNameLike": '',
            "productTypeName": '',
            "productTypeNameLike": '',
            "language": 'zh-TW',
            "investId": '',
            "spName": '',
            "spNameLike": '',
            "currency": '',
            "isHistory": '0',
            "auditStatus": '',
            "page": '1',
            "size": '20'

        }


class AuditInvestStatus(BasePrimeAdminApi):
    """
    运营平台审核理财项目
    """

    def __init__(self, auditId):
        super().__init__()
        self.url = f'{self.host}/api/prime/audit/invest/status/'
        self.method = 'put'
        self.json = {
            "auditStatus": 2,
            "twReason": "中文审核原因",
            "enReason": "英文审核原因",
            "auditId": auditId
        }


class StrategyAdd(BasePrimeAdminApi):
    """
    创建理财策略
    """

    def __init__(self, nameZh, investCurrency, investId):
        super().__init__()
        self.url = f'{self.host}/api/prime/strategy/add/'
        self.method = 'post'
        self.json = {
            "nameZh": nameZh,
            "nameEn": "英文自动测试",
            "pushStatus": 1,
            "strategyType": 1,
            "sort": 111,
            "investCurrency": investCurrency,
            "directionType": 0,
            "remark": "备注1234",
            "contractUrls": [],
            "contractShow": 1,
            "investList": [{
                "investId": investId,
                "productType": 3
            }]
        }


if __name__ == '__main__':
    print(666000000000 + random.randint(0, 999999999))
